Skip to content

Comments

feat: implement get_top_winners function for market contract#147

Merged
GoSTEAN merged 6 commits intoNetwalls:mainfrom
GoodnessJohn:feature/get-top-winners-68
Feb 21, 2026
Merged

feat: implement get_top_winners function for market contract#147
GoSTEAN merged 6 commits intoNetwalls:mainfrom
GoodnessJohn:feature/get-top-winners-68

Conversation

@GoodnessJohn
Copy link
Contributor

  • Add get_top_winners() function that returns top N winners sorted by payout
  • Validates market is in RESOLVED state before execution
  • Handles edge cases: zero limit, no winners, limit exceeds total
  • Implements deterministic sorting using bubble sort
  • Add test helper test_get_top_winners_with_users() for comprehensive testing
  • Add 8 comprehensive test cases covering all scenarios
  • Include detailed documentation and quick reference guide

Closes #68

@GoSTEAN
Copy link
Contributor

GoSTEAN commented Feb 21, 2026

@GoodnessJohn resolve conflict

- Add get_top_winners() function that returns top N winners sorted by payout
- Validates market is in RESOLVED state before execution
- Handles edge cases: zero limit, no winners, limit exceeds total
- Implements deterministic sorting using bubble sort
- Add test helper test_get_top_winners_with_users() for comprehensive testing
- Add 8 comprehensive test cases covering all scenarios
- Include detailed documentation and quick reference guide

Closes Netwalls#68
@GoodnessJohn GoodnessJohn force-pushed the feature/get-top-winners-68 branch from 1ff713b to d5016a9 Compare February 21, 2026 15:09
- Rename function to match issue Netwalls#68 requirement
- Update test helper name to test_get_market_leaderboard_with_users
- Rename test module to market_leaderboard_tests
- Update all test function names accordingly
- Implementation remains the same: returns top N winners sorted by payout
- Format function signature with proper line breaks
- Remove trailing whitespace
- Format long function calls across multiple lines
- Apply consistent spacing in code blocks
- Rename test_get_market_leaderboard_with_users to test_get_leaderboard_with_users (32 chars max)
- Prefix unused variables with underscore: _winning_outcome, _total_pool
- Fixes compilation error: contract function name too long
- Add fallback for ESLint check to prevent script failure
- ESLint v10 requires new config format but package uses v8
- Put test_get_leaderboard_with_users calls on single line
- Shorter function name now fits rustfmt line length requirements
@GoSTEAN GoSTEAN merged commit ff600ab into Netwalls:main Feb 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Contract] Implement get_market_leaderboard

2 participants